// @ts-ignore
import { api } from '@/utils/api';

/** 获取所有系统监控信息 POST /console/system/all */
export async function consoleSystemAll(
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultAllConsoleInfo>;

export async function consoleSystemAll(
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultAllConsoleInfo>>;

export async function consoleSystemAll(
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultAllConsoleInfo>;

export async function consoleSystemAll(options?: ArgumentsType<typeof api>[1]) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultAllConsoleInfo>(`/app/console/system/all`, {
      method: 'POST',
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultAllConsoleInfo>(`/app/console/system/all`, {
    method: 'POST',
    ...(options || {})
  });
}

/** 获取CPU信息 POST /console/system/cpu */
export async function consoleSystemCpu(
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultICpuInfo>;

export async function consoleSystemCpu(
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultICpuInfo>>;

export async function consoleSystemCpu(
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultICpuInfo>;

export async function consoleSystemCpu(options?: ArgumentsType<typeof api>[1]) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultICpuInfo>(`/app/console/system/cpu`, {
      method: 'POST',
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultICpuInfo>(`/app/console/system/cpu`, {
    method: 'POST',
    ...(options || {})
  });
}

/** 获取物理磁盘信息 POST /console/system/hwDisk */
export async function consoleSystemHwDisk(
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultListHWDiskInfo>;

export async function consoleSystemHwDisk(
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultListHWDiskInfo>>;

export async function consoleSystemHwDisk(
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultListHWDiskInfo>;

export async function consoleSystemHwDisk(options?: ArgumentsType<typeof api>[1]) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultListHWDiskInfo>(`/app/console/system/hwDisk`, {
      method: 'POST',
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultListHWDiskInfo>(`/app/console/system/hwDisk`, {
    method: 'POST',
    ...(options || {})
  });
}

/** 获取java信息 POST /console/system/java */
export async function consoleSystemJava(
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultJavaInfo>;

export async function consoleSystemJava(
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultJavaInfo>>;

export async function consoleSystemJava(
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultJavaInfo>;

export async function consoleSystemJava(options?: ArgumentsType<typeof api>[1]) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultJavaInfo>(`/app/console/system/java`, {
      method: 'POST',
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultJavaInfo>(`/app/console/system/java`, {
    method: 'POST',
    ...(options || {})
  });
}

/** 获取逻辑磁盘信息 POST /console/system/osDisk */
export async function consoleSystemOsDisk(
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultListOSDiskInfo>;

export async function consoleSystemOsDisk(
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultListOSDiskInfo>>;

export async function consoleSystemOsDisk(
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultListOSDiskInfo>;

export async function consoleSystemOsDisk(options?: ArgumentsType<typeof api>[1]) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultListOSDiskInfo>(`/app/console/system/osDisk`, {
      method: 'POST',
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultListOSDiskInfo>(`/app/console/system/osDisk`, {
    method: 'POST',
    ...(options || {})
  });
}

/** 获取内存条信息 POST /console/system/physicalMemory */
export async function consoleSystemPhysicalMemory(
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultListPhysicalMemoryInfo>;

export async function consoleSystemPhysicalMemory(
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultListPhysicalMemoryInfo>>;

export async function consoleSystemPhysicalMemory(
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultListPhysicalMemoryInfo>;

export async function consoleSystemPhysicalMemory(options?: ArgumentsType<typeof api>[1]) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultListPhysicalMemoryInfo>(`/app/console/system/physicalMemory`, {
      method: 'POST',
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultListPhysicalMemoryInfo>(`/app/console/system/physicalMemory`, {
    method: 'POST',
    ...(options || {})
  });
}

/** 获取系统信息 POST /console/system/system */
export async function consoleSystemSystem(
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResultISystemInfo>;

export async function consoleSystemSystem(
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResultISystemInfo>>;

export async function consoleSystemSystem(
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResultISystemInfo>;

export async function consoleSystemSystem(options?: ArgumentsType<typeof api>[1]) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResultISystemInfo>(`/app/console/system/system`, {
      method: 'POST',
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResultISystemInfo>(`/app/console/system/system`, {
    method: 'POST',
    ...(options || {})
  });
}
